from appium.webdriver.common.appiumby import By

from page.page01_index import app_index
from tools import *


def app_login(driver,phone,pwd):
    # 点击我的
    driver.find_element(by=By.ID, value="com.tpshop.malls:id/mine_ll").click()
    # 点击头像
    driver.find_element(by=By.ID, value="com.tpshop.malls:id/head_img").click()
    # 输入账号密码,点击协议
    driver.find_element(by=By.ID, value="com.tpshop.malls:id/mobile_et").send_keys(phone)
    driver.find_element(by=By.ID, value="com.tpshop.malls:id/pwd_et").send_keys(pwd)
    driver.find_element(by=By.ID, value="com.tpshop.malls:id/agree_btn").click()
    # 点击登录按钮
    driver.find_element(by=By.ID, value="com.tpshop.malls:id/login_tv").click()
    # 获取登录成功后的用户名,判断是否登录成功

if __name__ == '__main__':
    driver = app_driver()
    app_index(driver)
    app_login(driver)
    driver_quit(driver)